import java.io.FileInputStream;
import java.io.FileNotFoundException;

import syntaxtree.*;
import visitor.*;

public class Main {
   public static void main(String [] args) {
      try {
         
    	MinijavaParser root = new MinijavaParser(System.in);
		
			//root = new MinijavaParser(new FileInputStream("testeFac.txt") );
		
         PrimeiroVisitor v = new PrimeiroVisitor();
         SegundoVisitor sv = new SegundoVisitor( v.visit(root.Program()) );
         sv.visit(root.Program());
		
      }
      catch (ParseException e) {
         System.out.println(e.toString());
      }
   }
}
